home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0027_Disk Parking.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-17  |  2KB  |  55 lines

  1. ===========================================================================
  2.  BBS: Canada Remote Systems
  3. Date: 07-11-93 (20:49)             Number: 30503
  4. From: JAN DOGGEN                   Refer#: NONE
  5.   To: MARK STEPHEN                  Recvd: NO  
  6. Subj: RE: PARK IT!                   Conf: (1221) F-PASCAL
  7. ---------------------------------------------------------------------------
  8.  -=> Quoting Mark Stephen to Herb Brown <=-
  9.  
  10.  HB> Anybody have any suggestions, experiences, trials, tribulations,
  11.  HB> videos, and/or code examples on how to park a hard drive?
  12.  
  13.  MS> Trouble is, I have no idea of how to find out if the code has actually
  14.  MS> done what I want it to, and there seems to be a real possibility of
  15.  
  16.  Yep, took me some time to figure out you can't test where the head is
  17.  (i.e. if the park was succesful).
  18.  I always assume that it won't do any harm on self-parking drives
  19.  (they just park twice).
  20.  Here's some code for Herb too; I guess he reads this too.
  21.  
  22. PROCEDURE ParkDisk;
  23.   VAR Regs: Registers;
  24.   BEGIN
  25.     Regs.AH := $08;                { 'Return drive parameters' function }
  26.     Regs.DL := $80;           { Physical drive number - first hard disk }
  27.     Regs.AL := $00;
  28.     Intr($13,Regs);
  29.     Assert((Regs.Flags AND FCarry) = 0,
  30.       'Error getting disk parameters - AL returns '+IntToStr(Regs.AL,0));
  31.     { Now: DL = Number of drives responding                             }
  32.     {      DH = Maximum head number (# heads - 1)                       }
  33.     {      CH = Maximum cylinders/tracks (# tracks - 1) - lower 8 bits  }
  34.     {      CL = Higher 2 bits: high 2 bits of max cyl/tr                }
  35.     {           Lower 6 bits: Maximum sector number                     }
  36.     { We now position the heads using the BIOS Seek service. We can use }
  37.     { the returned registers again if we set DL back to $80.            }
  38.     Regs.AH := $0C;
  39.     Regs.DL := $80;
  40.     Intr($13,Regs);
  41.     Assert((Regs.Flags AND FCarry) = 0,
  42.       'Error parking disk - AL returns '+IntToStr(Regs.AL,0));
  43.   END; { ParkDisk }
  44.  
  45.  MS> How about ignoring the problem, and if trouble develops, blaming it on
  46.  MS> the hardware? (I believe this is the traditional approach?) The code
  47.  
  48.  Some approach!
  49.  
  50.  Jan
  51. ___ Blue Wave/QWK v2.10
  52.  
  53. --- Maximus 2.01
  54.  * Origin: *** DOSBoss Zuid *** (2:500/131)
  55.